/*    */ package com.zimbra.cs.service.formatter;
/*    */ 
/*    */ import com.zimbra.common.util.tar.TarEntry;
/*    */ import com.zimbra.common.util.tar.TarOutputStream;
/*    */ import java.io.IOException;
/*    */ import java.io.OutputStream;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class TarArchiveOutputStream
/*    */   implements ArchiveFormatter.ArchiveOutputStream
/*    */ {
/*    */   private TarOutputStream os;
/*    */   
/*    */   public class TarArchiveOutputEntry
/*    */     implements ArchiveFormatter.ArchiveOutputEntry
/*    */   {
/*    */     private TarEntry entry;
/*    */     
/*    */     public TarArchiveOutputEntry(String path, String name, int type, long date)
/*    */     {
/* 33 */       this.entry = new TarEntry(path);
/* 34 */       this.entry.setGroupName(name);
/* 35 */       this.entry.setMajorDeviceId(type);
/* 36 */       this.entry.setModTime(date);
/*    */     }
/*    */     
/*    */ 
/* 40 */     public void setUnread() { this.entry.setMode(this.entry.getMode() & 0xFF7F); }
/*    */     
/* 42 */     public void setSize(long size) { this.entry.setSize(size); }
/*    */   }
/*    */   
/*    */ 
/*    */   public TarArchiveOutputStream(OutputStream os, String cset)
/*    */     throws IOException
/*    */   {
/* 49 */     this.os = new TarOutputStream(os, cset);
/* 50 */     this.os.setLongFileMode(2);
/*    */   }
/*    */   
/* 53 */   public void close() throws IOException { this.os.close(); }
/*    */   
/* 55 */   public void closeEntry() throws IOException { this.os.closeEntry(); }
/*    */   
/* 57 */   public OutputStream getOutputStream() { return this.os; }
/*    */   
/* 59 */   public int getRecordSize() { return this.os.getRecordSize(); }
/*    */   
/*    */   public ArchiveFormatter.ArchiveOutputEntry newOutputEntry(String path, String name, int type, long date)
/*    */   {
/* 63 */     return new TarArchiveOutputEntry(path, name, type, date);
/*    */   }
/*    */   
/*    */   public void putNextEntry(ArchiveFormatter.ArchiveOutputEntry entry) throws IOException {
/* 67 */     this.os.putNextEntry(((TarArchiveOutputEntry)entry).entry);
/*    */   }
/*    */   
/* 70 */   public void write(byte[] buf) throws IOException { this.os.write(buf); }
/*    */   
/*    */   public void write(byte[] buf, int offset, int len) throws IOException {
/* 73 */     this.os.write(buf, offset, len);
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/service/formatter/TarArchiveOutputStream.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */